package org.whh.automatic;

import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.context.ConfigurableApplicationContext;
import org.whh.automatic.ui.MainFrame;

/**
 * 自动操作工具主应用类
 */
@SpringBootApplication
public class AutomaticOperationApplication {

    /**
     * 主方法
     */
    public static void main(String[] args) {
        // 使用Headless模式
        System.setProperty("java.awt.headless", "false");

        // 启动Spring应用（使用SWING_APP环境）
        SpringApplicationBuilder builder = new SpringApplicationBuilder(AutomaticOperationApplication.class);
        builder.headless(false);
        ConfigurableApplicationContext context = builder.run(args);

        // 获取主界面并显示
        MainFrame mainFrame = context.getBean(MainFrame.class);
        mainFrame.init();
        mainFrame.showUI();
    }
}
